package com.zr.planclass.mapper;

import com.zr.planclass.pojo.PlanClass;
import com.zr.planclass.pojo.PlanClassSelectVo;
import com.zr.planclass.pojo.PlanClassUpdateVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by 86151 on 2019/6/14.
 */
@Mapper
public interface PlanClassMapper {
    @Select("select * from planclass where code = #{code}")
    List<PlanClass> queryByCode(String code);

    /*@Select("select * from planclass where name = #{name}")
    List<PlanClass> queryByName(String name);*/

    /*@Insert("insert into planclass (name,code,content,status,createTime,createName,updateTime," +
            "updateName) values (#{name},#{code},#{remark},#{status},#{createTime},#{createName},#{updateTime},#{updateName}) ")
    int addPlanClass(PlanClass planClass);*/

    @Select("select * from planclass where id=#{id}")
    PlanClass queryById(Integer id);

    List<PlanClass> queryPage(PlanClassSelectVo planClassSelectVo);
    int queryCount(PlanClassSelectVo planClassSelectVo);

    @Update("update planclass set content= #{remark},status=#{status},name=#{name},version = #{version}+1 where id = #{id} and version = #{version}")
    int updatePlanClass(PlanClass planClass);

    @Update("update planclass set status=#{status} where id = #{id}")
    void updateStatus(PlanClass planClass);

    @Select("select * from planclass where id=#{id}")
    PlanClass queryPlantById(Integer id);

    @Select("select * from planclass where name =#{name} and  id!=#{id}")
    List<PlanClass> queryByAll(PlanClassUpdateVo planClassUpdateVo);

    List<String> queryByCodes(List<String> codeList);

    List<String> queryByNames(List<String> nameList);

    int addPlanClassList(List<PlanClass> planClassList);

    List<PlanClass> queryBySelectVo(PlanClassSelectVo planClassSelectVo);
}
